/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package javaapplication1;

/**
 *
 * @author user
 */
public class bai15 {
    public static void main(String[] args) {
        System.out.println(Invert(changeDecimalToBinary(128)));
        
    }
    
    private static int Invert(String s){
        String s1="";
        while (!s.equals("")) {
            s1+=s.substring(s.length()-1, s.length());
            s=s.substring(0, s.length()-1);
        }
        return Integer.parseInt(s1);
    }
    
    private static String changeDecimalToBinary(int n){
        if(n<=1) return String.valueOf(n);
        return String.valueOf(n%2)+changeDecimalToBinary(n/2);
    }
}

//   private static String NhiPhan(int n) 
//   {
//       if(n==1) return "1";
//       else
//       {
//           return NhiPhan(n/2) + (n%2);
//       }           
//   }}